package prosjekt;

public class OrdreKvittering {

	private String kvittering;
	private String produkter;
	private int kundeID;
	private String kunde;
	private String sum;
	private String mva;
	private String total;
	private String levering;
	
    public OrdreKvittering(String produkter, int kundeID, String kunde, 
    						String sum, String mva, String total, String levering) {
    	this.produkter = produkter;
    	this.kundeID = kundeID;
    	this.kunde = kunde;
    	this.sum = sum;
    	this.mva = mva;
    	this.total = total;
    	this.levering = levering;
    	
    	genererKvittering();
    }
    
    public void genererKvittering() {
    	kvittering = "Kundeid:\t" + getKundeID() + "\n" 
		 			 + "Kunde:\t" + getKunde() + "\n\n"
		 			 + "Varer:\n"
		 			 + getProdukter()+ "\n" 
		 			 + "Sum:\t" + getSum() + " Kr" + "\n" 
		 			 + "Mva:\t" + getMVA() + " Kr" + "\n" 
		 			 + "Total:\t" + getTotal() + " Kr" + "\n\n"
		 			 + getLevering() + "\n\n";	
    }
    
    public String getSum() {
    	return sum;
    }
    
    public String getMVA() {
    	return mva;
    }
    
    public String getTotal() {
    	return total;
    }
    
    public String getKvittering() {
    	return kvittering;
    }
    
    public String getKunde() {
    	String[] tmp = kunde.split("\\s");
    	String navn = "";
        for (int i = 0; i < tmp.length; i++) {
			if (i == 0) {
				navn = tmp[0] + ",";
			}
			else {
				navn += " " + tmp[i];
			}
		}
        return navn;
    }
    
    public int getKundeID() {
    	return kundeID;
    }
    
    public String getProdukter() {
    	return produkter;
    }
    
    public String getLevering() {
    	return levering;
    }
    
}